import express from 'express';
import {
  getWorks,
  getWorkById,
  createWork,
  updateWork,
  deleteWork,
} from '../controllers/workController';
import { protect } from '../middleware/authMiddleware';

const router = express.Router();

router.route('/')
    .get(getWorks)
    .post(protect, createWork);

router.route('/:id')
    .get(getWorkById)
    .put(protect, updateWork)
    .delete(protect, deleteWork);

// 【FIX】Ensure this line exists at the end of the file to provide the default export.
export default router;